﻿#pragma warning(disable: 4996)
#pragma warning(disable: 6031)

#include <stdio.h>

void solve1(int s, int e) {
	int h = s / 100;
	int m = s % 100;
	//m += e; 有错误???  因为单独的算, m可能为负值
	//h += m / 60;
	m += e + h*60;	// 下面的算法把小时制全部转换成分钟,统一操作
	h = m / 60;
	m %= 60;
	printf("%d", h*100+ m);
}

void solve2(int s, int e) {
	int h = s / 100;
	int m = s % 100;
	m += e;
	h += m / 60;
	m %= 60;
	if (m < 0) {
		m += 60;
		h--;
	}
	printf("%d", h * 100 + m);
}

void solve(int s, int e) {
	int h = s / 100;
	int m = s % 100;
	m += h * 60 + e;
	h = m / 60;
	m %= 60;
	printf("%d\n", h*100+m);
}

int main()
{
	freopen("D:/Develop/GitRepos/MOOC/浙江大学/数据结构/201906/DataStructure/M2019秋C入门和进阶练习集/7-14.txt", "r", stdin);
	int s, e;
	scanf("%d %d", &s, &e);
	solve(s, e);
	solve2(s, e);
	return 0;
}